<template>
	<view>
		<view class="smart-panel-title">自定义组件</view>
		<navigator url="/components/cardViewPage/cardViewPage">
			<text>置顶新闻组件</text>
		</navigator>
		<navigator url="/pages/Custom/newsPage/newsPage">
			<text>三合一新闻组件</text>
		</navigator>
		<navigator url="/pages/IntentPage/IntentPage">
			<text>组件传值页面</text>
		</navigator>

		<view class="smart-panel-title">1.容器</view>
		<view class="smart-panel-h" @click="goDetailPage('view')" style="text-indent:1em;"><text>view视图</text></view>


		<view class="smart-panel-title">2.基础内容</view>
		<view class="smart-panel-h" @click="goDetailPage('text')" style="text-indent:1em;"><text>text文本</text></view>
		<view class="smart-panel-h" @click="goDetailPage('icon')" style="text-indent:1em;"><text>icon图标</text></view>

		<view class="smart-panel-title">3.表单组件</view>
		<view class="smart-panel-h" @click="goDetailPage('button')" style="text-indent:1em;"><text>button按钮</text>
		</view>
		<view class="smart-panel-h" @click="goDetailPage('checkbox')" style="text-indent:1em;"><text>checkbox多选框</text>
		</view>
		<view class="smart-panel-h" @click="goDetailPage('label')" style="text-indent:1em;"><text>label标签组件</text>
		</view>
		<view class="smart-panel-h" @click="goDetailPage('input')" style="text-indent:1em;"><text>input输入框</text></view>
		<view class="smart-panel-h" @click="goDetailPage('textarea')" style="text-indent:1em;">
			<text>textarea多行文本输入框</text></view>
		<view class="smart-panel-h" @click="goDetailPage('form')" style="text-indent:1em;"><text>form表单</text></view>

		<view class="smart-panel-title">4.导航组件</view>
		<view class="smart-panel-h" @click="goDetailPage('navigator')" style="text-indent:1em;"><text>navigator</text>
		</view>


		<view class="smart-panel-title">5.图片组件</view>
		<view class="smart-panel-h" @click="goDetailPage('image')" style="text-indent:1em;"><text>image图片组件</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {

			}
		},
		// 修复生命周期钩子拼写错误：onshow -> onShow
		onShow() {
			console.log("组件页onshow");
			uni.getStorage({
				key: 'UserName',
				success(result) {
					// 修复存储值获取逻辑：添加 .data 获取实际存储内容
					console.log("成功" + result.data);
				},
				fail(errMsg) {
					console.log("失败" + JSON.stringify(errMsg));
				}
			})
		},
		// 修复语法错误：添加逗号分隔onShow和methods
		methods: {
			goDetailPage(e) {
				if (typeof e === 'string') {
					uni.navigateTo({
						url: '/pages/components/' + e + '/' + e
					});
				} else {
					uni.navigateTo({
						url: e.url
					});
				}
			}
		}
	}
</script>

<style>
	.smart-innel-panel {
		background-color: #aa99ff;
		flex-direction: row;
		align-items: center;
		padding: 12px;
		margin-bottom: 2px;
	}
</style>